# coding=utf-8

from application import app
from flask import request
from app.interceptors.Auth.Execute import \
    before_api_request, before_web_request, before_admin_request, before_default_request


@app.before_request
def before_request():
    path = request.path
    if app.config["ROUTE"]["route_api"] in path:
        return before_api_request(path)
    elif app.config["ROUTE"]["route_web"] in path:
        return before_web_request(path)
    elif app.config["ROUTE"]["route_admin"] in path:
        return before_admin_request(path)
    else:
        return before_default_request(path)
